

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>添加角色</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all">
</head>
<body>

<form id="myform" class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
  <!--id在页面中隐藏了，前端传递给后端也传递了id值  -->
  <input type="hidden" name="id">
  <!--角色编码-->
  <div class="layui-form-item">
    <label class="layui-form-label required">员工编码:</label>
    <div class="layui-input-inline">
      <input type="text" name="name_num" lay-verify="required" placeholder="0000" autocomplete="off" class="layui-input">
    </div>
  </div>

  <!--角色名称-->
  <div class="layui-form-item">
    <label class="layui-form-label required">员工姓名:</label>
    <div class="layui-input-inline">
      <input type="text" name="username" lay-verify="required" placeholder="请输入员工姓名" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">性别:</label>
    <div class="layui-input-inline">
      <input type="radio" name="sex" value="1" title="男" checked>
      <input type="radio" name="sex" value="2" title="女">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">状态:</label>
    <div class="layui-input-inline">
      <input type="radio" name="status" value="1" title="启用" checked>
      <input type="radio" name="status" value="2" title="禁用">
    </div>
  </div>
  <!--所属部门-->
  <div class="layui-form-item">
    <label class="layui-form-label">所属部门:</label>
    <div class="layui-input-inline">
      <select name="department_name">
        <option value="">--请选择部门--</option>
        <option value="1">总经办</option>
        <option value="2">市场发展部</option>
        <option value="3">业务一部</option>
        <option value="4">业务二部</option>
        <option value="5">综合部</option>
        <option value="6">财务部</option>
      </select>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label required">角色身份:</label>
    <div class="layui-input-inline">
      <input type="text" name="role_name" lay-verify="required" placeholder="请输入角色身份" autocomplete="off" class="layui-input">
    </div>
  </div>
  <!--备注信息-->
  <div class="layui-form-item">
    <label class="layui-form-label required">备注信息</label>
    <div class="layui-input-inline">
      <input type="text" name="mark" lay-verify="required" placeholder="备注" autocomplete="off" class="layui-input">
    </div>
  </div>
  <!--确认提交-->
  <div class="layui-form-item layui-hide">
    <input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-back-submit" value="确认">
  </div>
</form>

  <!--引入本地layui.js-->
  <script src="../../static/layui/layui.js"></script>
  <!--js-->
  <script type="text/javascript">
      layui.config({
          base: '../../static/layui/layuiadmin/' //静态资源所在路径js
      }).extend({
          index: 'lib/index' //主入口模块
      }).use('index');
  </script>
  <script>
      /*layui.use('laydate', function() {
          var laydate = layui.laydate;
          //常规用法
          laydate.render({
              elem: '#employee_birthday'
          });

      });*/
  </script>
  <!-- 注意：如果你直接复制所有代码到本地，上述 JS 路径需要改成你本地的 -->
  <script>
      layui.use(['form', 'layedit', 'laydate'], function(){
          var form = layui.form
              ,layer = layui.layer
              ,layedit = layui.layedit
              ,laydate = layui.laydate;

          //自定义验证规则
          form.verify({
              title: function(value){
                  if(value.length < 5){
                      return '标题至少得5个字符啊';
                  }
              }
              ,pass: [
                  /^[\S]{6,12}$/
                  ,'密码必须6到12位，且不能出现空格'
              ]
              ,content: function(value){
                  layedit.sync(editIndex);
              }
          });




      });
  </script>

</body>
</html>


</body>
</html>